import { createRouter, createWebHashHistory, createWebHistory, RouteRecordRaw } from 'vue-router';
import { App } from 'vue';
import { default as basicRoutes } from '@/router/routes';

const routes = [] as RouteRecordRaw[];

routes.push(...basicRoutes);

export const router = createRouter({
  history: createWebHashHistory(),
  routes,
  scrollBehavior(to, from, savedPosition) {
    if (savedPosition) {
      return savedPosition;
    } else {
      return { top: 0 };
    }
  },
});

//setup router
export const setupRouter = (app: App) => {
  app.use(router);
};
